﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bookkeeping.Core.Services;

namespace Bookkeeping.Mvc.Models.Budget
{
    public class MonthNavigationViewModel
    {
        public DateTime Date { get; set; }
        public DateTime PreviousMonthDate { get; set; }
        public DateTime NextMonthDate { get; set; }

        public string DateString
        {
            get
            {
                string monthName = DateTimeHelper.GetMonthName(Date);
                string capitalizedMonthName = Formatter.CapitalizeFirstLetter(monthName);

                return capitalizedMonthName + " " + Date.Year;
            }
        }

        public object PreviousMonthLinkArgumentList
        {
            get
            {
                return CreateArgumentList(PreviousMonthDate);
            }
        }

        public object NextMonthLinkArgumentList
        {
            get
            {
                return CreateArgumentList(NextMonthDate);
            }
        }

        private object CreateArgumentList(DateTime date)
        {
            return new { Year = date.Year, Month = date.Month };
        }
    }
}
